import React, { Component } from 'react'
import Play from './play';
import VideoShow from './index'
export default class Video extends Component {
    state = {
        style: "list",
        stream_name: '',
        time1: '',
        time2: '',
        user_id: '',
        filename: ''
    };    
    change_stream = (value)=>{
        console.log(value)
        const {stream_name,time1,time2,user_id,filename} = value
        // console.log(stream_name,time1,time2)
        this.setState({
            stream_name,
            time1,
            time2,
            user_id,
            filename
        })
    }
    switchs = (value) => {
        this.setState({style:value})
    }
    render() {
        const {stream_name,time1,time2,user_id,filename} = this.state
        return (
            <div>
            {
                this.state.style === 'list'
                ?<VideoShow switchForm={this.switchs} stream_name={this.change_stream}></VideoShow>
                :<Play switchForm={this.switchs} stream_name={{stream_name,time1,time2,user_id,filename}}></Play>
            }
            </div>
        )
    }
}
